function submit(){
    var name = $('#name').val();
    var number = $('#number').val();
    var money = $('#money').val();
    var reason = $('#reason').val();
    var protocol = window.location.protocol;
    var host = window.location.host;
    if (name == ""){
        layer.open({
            title: '提示信息',
            anim: 0,
            resize:false,//是否可以拉伸  默认true
            icon: 2,
            shadeClose: true,
            skin: 'layui-layer-molv',
            content: "礼品名称不能为空！",
            yes:function (index){
                $('#name').focus();
                layer.close(index);
            }
        });
        return "";
    }
    if (number == ""){
        layer.open({
            title: '提示信息',
            anim: 0,
            resize:false,//是否可以拉伸  默认true
            icon: 2,
            shadeClose: true,
            skin: 'layui-layer-molv',
            content: "礼品数量不能为空！",
            yes:function (index){
                $('#age').focus();
                layer.close(index);
            }
        });
        return "";
    }
    if (money == ""){
        layer.open({
            title: '提示信息',
            anim: 0,
            resize:false,//是否可以拉伸  默认true
            icon: 2,
            shadeClose: true,
            skin: 'layui-layer-molv',
            content: "礼品金额不能为空！",
            yes:function (index){
                $('#birthday').focus();
                layer.close(index);
            }
        });
        return "";
    }
    if (reason == ""){
        layer.open({
            title: '提示信息',
            anim: 0,
            resize:false,//是否可以拉伸  默认true
            icon: 2,
            shadeClose: true,
            skin: 'layui-layer-molv',
            content: "购置礼品原因不能为空！",
            yes:function (index){
                $('#school').focus();
                layer.close(index);
            }
        });
        return "";
    }
    $.ajax({
        type : 'POST',
        url : '/elderlyGiftAdd',
        data : {name:name,number:number,money:money,reason:reason},
        success:function (data) {

            if (data == "OK"){
                layer.open({
                title: '提示信息',
                anim: 0,
                resize:false,//是否可以拉伸  默认true
                icon: 1,
                shadeClose: true,
                skin: 'layui-layer-molv',
                content: data,
                yes:function (index){
                    window.location.href = protocol+"//"+host+"/elderlyGiftList";
                    layer.close(index);
                }
            });
            }else {
                layer.open({
                    title: '提示信息',
                    anim: 0,
                    resize:false,//是否可以拉伸  默认true
                    icon: 2,
                    shadeClose: true,
                    skin: 'layui-layer-molv',
                    content: data
                });
            }
        },
        error: function (e) {
            console.log(e)
        }
    });
}